package com.zy.thread.ticket3;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/13 14:49
 **/
public class ThreadWindow implements Runnable{
    int tickets=100;//对象自己
    int i=1;

    @Override
    public void run() {
        while(true){
            if (tickets>0) {
                System.out.println(i+":"+Thread.currentThread().getName()+"正在售票...票号为："+
                        tickets--);
            }else{
                break;
            }
            i++;
        }
    }

}
